package com.taoge.electricalAppSystem.controller;

import com.taoge.electricalAppSystem.domain.User;
import com.taoge.electricalAppSystem.service.ShoppingServicesimpl;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class Controller {
    public static final Scanner INPUT = new Scanner(System.in);
    public static final ShoppingServicesimpl SSI = new ShoppingServicesimpl();
    public static final ShoopingController SC = new ShoopingController();
    public static void main(String[] args) {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日 HH:mm:ss");
        while(true){
        Date date = new Date();
        String format = sdf.format(date);
        System.out.println("\t\t\t\t\t\t" + format);
        System.out.println("******************************电器商城********************************");
        System.out.println("1.用户登录");
        System.out.println("2.用户注册");
        System.out.println("3.退出系统");
        System.out.println("******************************电器商城********************************");
            System.out.println("请输入菜单");
            Integer choice = INPUT.nextInt();
            switch(choice){
                case 1: // 用户登录功能
                    User user = SSI.logIn();
                    if(user != null){
                        SC.index(user);
                    }
                    break;
                case 2: // 用户注册功能
                    SSI.signIn();
                    break;
                case 3: // 退出系统
                    System.exit(0);
                     break;
            }
        }
    }

}
